package com.main.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.main.entity.User;
import com.main.mapper.UserMapper;
import com.main.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService{
    @Resource
    private UserMapper userMapper;
    @Override
    public List<User> selectList() {
       QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
//        userQueryWrapper.eq("username","柳岩");
  //      LambdaQueryWrapper<User> userQueryWrapper = new LambdaQueryWrapper<>();
//        userQueryWrapper.eq(User::getUsername,"柳岩");
//        等值查询-null的判断
//        String username=null;
//        userQueryWrapper.eq(username !=null,User::getUsername,username);
//        hashmap查询
        HashMap<String, Object> objectObjectHashMap = new HashMap<>();
//        objectObjectHashMap.put("username","柳岩");
         userQueryWrapper.allEq(objectObjectHashMap,false);
        return userMapper.selectList(userQueryWrapper);
    }
}
